package string;

import com.sun.org.apache.xerces.internal.impl.dv.util.Base64;

import java.io.File;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import java.util.regex.PatternSyntaxException;

/**
 * Created with IntelliJ IDEA.
 * User: leep
 * Date: 14-9-16
 * Time: 下午3:53
 * To change this template use File | Settings | File Templates.
 */
public class StringTestMain {
	public static void main(String[] args) {
		String a = "001001001001001001999";
		String b = "001001001001001001";
		String c = a.replace(b, "");
		Integer integer = Integer.valueOf(c);
		Integer r = integer + 1;
		String d = b + r;
		System.out.println(d);
		
		//		String a = new String("asdfasdfasdf");
		//		String b = a;
		//		System.out.println(b);
		//		b = "1111";
		//		System.out.println(b);
		//		System.out.println(a);
		//
		//		String s = "0123456789";
		//		String s1 = s.substring(0, 4);
		//		String s2 = s.substring(s.length() - 4, s.length());
		//		String s3 = s.substring(4, s.length() - 4);
		//		System.out.println(s1);
		//		System.out.println(s3);
		//		System.out.println(s2);
		//		byte[] st = Base64.decode("PCEtLSBuZ1JlcGVhdDogb2kgaW4gcmVjZWlwdFByaW50RGF0YS5vcmRlci5jYXJ0Lml0ZW1zIC0tPjxwPjwvcD48IS0tIG5nSWY6IHJlY2VpcHRQcmludERhdGEub3JkZXIucHJpbnRDb3VudC5raXRjaGVuQ291bnQ");
		//		String s = new String(st);
		//		System.out.println(s);
		//		String sb = "dddddffff";
		//		System.out.println(sb.indexOf("df"));
		//
		//
		//		String content = "[sdf]ffffff";
		//		content = content.replace("[sd1f]", "eeee");
		//		System.out.println(content);
		//
		//
		//		String aa = "[";
		//		if (aa.startsWith("[", 0)) {
		//			System.out.println("sdfsdf");
		//		}
		//
		//
		//		String str = "[{\"name\":\"code\",\"enable\":true,\"column\":0,\"label\":\"编码\",\"type\":\"string\"},{\"name\":\"name\",\"enable\":true,\"column\":1,\"label\":\"名称\",\"type\":\"string\"},{\"name\":\"price\",\"enable\":true,\"column\":2,\"label\":\"价格\",\"type\":\"number\"}]\n";
		//
		//
		//		String a = "880";
		//		int length = a.length();
		//		int beginIndex = length >= 8 ? length - 8 : 0;
		//		int endIndex = length >= 4 ? length - 4 : 0;
		//		String b = a.substring(beginIndex, endIndex);
		//		String c = a;
		//		if (beginIndex >= 0 && endIndex > 0)
		//			c = a.replaceFirst(b, "****");
		//		System.out.println(c);
		//
		//
		//		String email = "a@v.c";
		//		int code = email.indexOf("@");
		//		String w = email.substring(code + 1, email.length());
		//		String d = email.replace(w, "*.*");
		//		System.out.println(d);
		//
		//
		//		String message = "Coercion of hhh to type java.lang.Float (via String --> Double, Double --> Float) failed: For input string:";
		//		Pattern regex = Pattern.compile("^Coercion of (.*) to type java.lang.([a-zA-z]*) \\(");
		//		Matcher regexMatcher = regex.matcher(message);
		//		if (regexMatcher.find()) {
		//			System.out.println(regexMatcher.group(1));
		//			System.out.println(regexMatcher.group(2));
		//		}
		
		//		String s = "<com.tencent.protocol.pay_protocol.ScanPayReqData>\n" +
		//				"  <appid>wx571d23264e572102</appid>\n" +
		//				"  <mch_id>1235018702</mch_id>\n" +
		//				"  <device_info></device_info>\n" +
		//				"  <nonce_str>x3p5rf2sy1qo7x0gjsd8ip9h4loeu9lf</nonce_str>\n" +
		//				"  <sign>F209438A77290604F853F76F4D287A05</sign>\n" +
		//				"  <body>孫記膳坊支付</body>\n" +
		//				"  <attach></attach>\n" +
		//				"  <out_trade_no>dds4sdfsdfsdfdsfsdf4</out_trade_no>\n" +
		//				"  <total_fee>1</total_fee>\n" +
		//				"  <spbill_create_ip>192.168.1.88</spbill_create_ip>\n" +
		//				"  <time_start></time_start>\n" +
		//				"  <time_expire></time_expire>\n" +
		//				"  <goods_tag></goods_tag>\n" +
		//				"  <auth_code>130322663343818610</auth_code>\n" +
		//				"</com.tencent.protocol.pay_protocol.ScanPayReqData>";
		//		System.out.println(s.replaceAll("com.tencent.protocol.*>", "xml>"));
		//		System.out.println(StringTestMain.class.getResource(""));
		//		File directory = new File("");//设定为当前文件夹
		//		try {
		//			System.out.println(directory.getCanonicalPath());//获取标准的路径
		//			System.out.println(directory.getAbsolutePath());//获取绝对路径
		//		} catch (Exception e) {
		//		}
		//		StringTestMain stringTestMain = new StringTestMain();
		//		stringTestMain.d();
		
		//		String name = "POS-1";
		//		String ResultString = null;
		//		try {
		//			Pattern regex = Pattern.compile("[\\d]");
		//			Matcher regexMatcher = regex.matcher(name);
		//			if (regexMatcher.find()) {
		//				ResultString = regexMatcher.group();
		//			}
		//			System.out.println(ResultString);
		//		} catch (PatternSyntaxException ex) {
		//			// Syntax error in the regular expression
		//		}
		
	}
	
	public void d() {
		File f = new File(this.getClass().getResource("/").getPath());
		System.out.println(f);
	}
}
